package id.co.rho.scoring.cid.client.scaffold;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.DialogBox;

import id.co.rho.scoring.cid.client.helper.Entry;
import id.co.rho.scoring.cid.client.mvc.AppEvents;
import id.co.rho.scoring.cid.client.scaffold.ioc.ExtDesktopInjectorWrapper;
import id.co.rho.scoring.cid.client.scaffold.ioc.InjectorWrapper;

/**
 * Application for browsing entities.
 */
public class Scaffold implements EntryPoint {
    final private InjectorWrapper injectorWrapper = GWT.create(ExtDesktopInjectorWrapper.class);

    public void onModuleLoad() {
        injectorWrapper.getInjector().getScaffoldApp().run();
    }

    public static void showPage(Entry entry) {
        AppEvent appEvent = new AppEvent(AppEvents.ShowPage, entry);
        appEvent.setHistoryEvent(true);
        appEvent.setToken(entry.getId());
        Dispatcher.forwardEvent(appEvent);
    }
}